
var bathUrl="";

function getUrlParam(name) {
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  //构造一个含有目标参数的正则表达式对象
  var r = window.location.search.substr(1).match(reg);
  //匹配目标参数
  if (r != null) {
    return decodeURI(r[2])
    return null; //返回参数值
  }
}

//html剔除富文本标签，留下纯文本
function getSimpleText(html){
  var re1 = new RegExp("<.+?>","g");//匹配html标签的正则表达式，"g"是搜索匹配多个符合的内容
  var msg = html.replace(re1,'');//执行替换成空字符
  return msg;
}

function HTMLDecode(text) {
var temp = document.createElement("div");
temp.innerHTML = text;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
}

 function backIndex(){
   window.location.href="/page";
 }

 function back(){
    window.history.back;
 }


 //获取当前年月日
 function formatDate() {
   var nowdate = new Date;
   var year = nowdate.getFullYear();
   var month = (nowdate.getMonth() + 1) >= 10 ? (nowdate.getMonth() + 1) : "0" + (nowdate.getMonth() + 1);
   var date = nowdate.getDate() >= 10 ? nowdate.getDate() : "0" + nowdate.getDate();
   var tempDate = year + "-" + month + "-" + date;
   return tempDate
 }

   function getSuffix(filename) {
       return /\.[^\.]+$/.exec(filename)
   }

  //验证邮箱是否合法
    function isEmail(strEmail) {
    var flag = strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/);
        if (flag == -1){
         layer.msg("邮箱不不正确");

        }
        return flag!=-1;
    }


  //验证手机号是否合法
    function isPhone(phone){ //alert(phone)
        var RegCellPhone = /^(1)([0-9]{10})?$/;
        var  falg=phone.search(RegCellPhone);
        if (falg==-1){
            layer.msg("手机号不正确");
            this.focus();
        }
        return falg!=-1;
    }

  //验证id号是否合法
    function isIDCard(idCard){
    var reg=/^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
        if(!reg.test(idCard)){
         layer.msg("身份证号码不正确");
        }
    	return reg.test(idCard);
    }


function show(str){
	$('body').append('<div id="alert">'+str+'</div>')
	$('#alert').html(str);
	$('#alert').css('display', 'block');
	setTimeout(function(){
		$('#alert').remove();
	}, 2000);
}
/*
 弹框
 * */
function ShowDiv(show_div,bg_div, event){
	document.getElementById(show_div).style.display='block';
	document.getElementById(bg_div).style.display='block' ;
	var bgdiv = document.getElementById(bg_div);
	bgdiv.style.width = document.body.scrollWidth;
	$("#"+bg_div).height($(document).height());
	$("body,html").css({"height":"auto","overflow":"hidden"});
};


	//关闭弹出层
function CloseDiv(show_div,bg_div){
	document.getElementById(show_div).style.display='none';
	document.getElementById(bg_div).style.display='none';
	$("body,html").css({"height":"auto !important","overflow":"auto"});
};